{template 'common/header'}
<ul class="nav nav-tabs">
    <li><a href="{php echo $this->createWebUrl('template')}">风格管理</a></li>
	<li class="active"><a href="{php echo $this->createWebUrl('menu', array('op' => 'display'))}">业务关联</a></li>
</ul>
<input type="hidden" name="storeid" value="{$storeid}" />
<link rel="stylesheet" type="text/css" href="../addons/weisrc_icard/template/css/icon.css?v=1" media="all">
{if $operation == 'display'}
<div class="main">
    <div class="panel panel-default">
        <div class="panel-body">
            <a class="btn btn-primary" href="{php echo $this->createWebUrl('menu', array('op' => 'post'))}"><i class="fa fa-plus"></i> 添加业务</a>
        </div>
    </div>
    <form action="" method="post" class="form-horizontal form">
        <div class="panel panel-default">
            <div class="panel-heading">业务管理</div>
            <div class="table-responsive panel-body">
            <table class="table table-hover">
                <thead class="navbar-inner">
                <tr>
                    <th style="width:10%;">显示顺序</th>
                    <th style="width:5%">图标</th>
                    <th style="width:20%;">业务名称</th>
                    <th style="width:40%;">链接</th>
                    <th style="width:10%;">状态</th>
                    <th style="width:15%;">编辑/显隐/删除</th>
                </tr>
                </thead>
                <tbody>
                {loop $menu $row}
                <tr>
                    <td><input type="text" class="form-control" name="displayorder[{$row['id']}]" value="{$row['displayorder']}"></td>
                    <td><div class="icons {if empty($row['icon'])}li_a{else}{$row['icon']}{/if}"></div></td>
                    <td>
                        <input type="text" class="form-control" name="title[{$row['id']}]" value="{$row['title']}">
                    </td>
                    <td><input type="text" class="form-control" name="content[{$row['id']}]" value="{$row['url']}"></td>
                    <td>
                        {if $row['status']==1}
                        <span class="label label-default label-success">显示</span>
                        {else}
                        <span class="label label-default label-error">隐藏</span>
                        {/if}
                    </td>
                    <td>
                        <a class="btn btn-default btn-sm" href="{php echo $this->createWebUrl('menu', array('op' => 'post', 'id' => $row['id']))}"><i class="fa fa-pencil"></i></a>
                        <a class="btn btn-default btn-sm" href="{php echo $this->createWebUrl('menu', array('op' => 'check', 'id' => $row['id']))}" onclick="return confirm('确认操作吗？');return false;" title="{if $row['status']==1}暂停{else}启用{/if}"><i class="fa fa-{if $row['status']==1}stop{else}play{/if}"></i></a>
                        <a class="btn btn-default btn-sm" onclick="return confirm('确认删除吗？');return false;" href="{php echo $this->createWebUrl('menu', array('op' => 'delete', 'id' => $row['id']))}"><i class="fa fa-times"></i></a>
                    </td>
                </tr>
                {/loop}
                <tr>
                    <td colspan="6">
                        <input name="submit" type="submit" class="btn btn-primary" value="批量排序">
                        <input type="hidden" name="token" value="{$_W['token']}" />
                    </td>
                </tr>
                </tbody>
            </table>
            </div>
        </div>
    </form>
    {$pager}
</div>
{elseif $operation == 'post'}
<div class="main">
    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
        <input type="hidden" name="parentid" value="{$parent['id']}" />
        <div class="panel panel-default">
            <div class="panel-heading">
                {$title}
            </div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">名称</label>
                    <div class="col-sm-9">
                        <input type="text" id="title" name="title" class="form-control" value="{$menu['title']}" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">图标</label>
                    <div class="col-sm-9">
                        <input class="form-control" type="hidden" name="icon" id="icon" value="{$menu['icon']}" />
                        <div id="showicon" class="icons {if empty($menu['icon'])}li_a{else}{$menu['icon']}{/if}" style="margin-top: 7px;"></div>
                        <br/>
                        <div class="icon-selection" style="margin-top: 10px;padding-top:3px;border-top-style: dashed;border-top-width: 1px;border-color: rgba(45, 0, 0, 0.1);">
                            <div class="clearfix">
                                <a href='javascript:;' onClick="selectIcon(this,'li_a');" title="black sun with rays"><div><span class="icons li_a "></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_b');" title="black sun with rays"><div><span class="icons li_b"></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_c');" title="black sun with rays"><div><span class="icons li_c"></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_d');" title="black sun with rays"><div><span class="icons li_d"></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_e');" title="black sun with rays"><div><span class="icons li_e"></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_f');" title="black sun with rays"><div><span class="icons li_f"></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_g');" title="black sun with rays"><div><span class="icons li_g"></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_h');" title="black sun with rays"><div><span class="icons li_h"></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_i');" title="black sun with rays"><div><span class="icons li_i"></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_j');" title="black sun with rays"><div><span class="icons li_j"></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_k');" title="black sun with rays"><div><span class="icons li_k"></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_l');" title="black sun with rays"><div><span class="icons li_l"></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_m');" title="black sun with rays"><div><span class="icons li_m"></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_n');" title="black sun with rays"><div><span class="icons li_n"></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_o');" title="black sun with rays"><div><span class="icons li_o"></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_p');" title="black sun with rays"><div><span class="icons li_p"></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_q');" title="black sun with rays"><div><span class="icons li_q"></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_r');" title="black sun with rays"><div><span class="icons li_r"></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_s');" title="black sun with rays"><div><span class="icons li_s"></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_t');" title="black sun with rays"><div><span class="icons li_t"></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_u');" title="black sun with rays"><div><span class="icons li_u"></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_v');" title="black sun with rays"><div><span class="icons li_v"></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_w');" title="black sun with rays"><div><span class="icons li_w"></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_x');" title="black sun with rays"><div><span class="icons li_x"></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_y');" title="black sun with rays"><div><span class="icons li_y"></span></div><span></span></a>
                                <a href='javascript:;' onClick="selectIcon('li_z');" title="black sun with rays"><div><span class="icons li_z"></span></div><span></span></a>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">链接</label>
                    <div class="col-sm-9">
                        <input class="form-control" type="text" name="url" id="url" value="{$menu['url']}" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">状态</label>
                    <div class="col-sm-9">
                        <label for="status_1" class="radio-inline"><input autocomplete="off" type="radio" name="status" id="status_1" value="1" {if $menu['status'] == 1 || empty($menu['status'])} checked="checked"{/if} /> 显示</label>
                        <label for="status_0" class="radio-inline"><input autocomplete="off" type="radio" name="status" id="status_0" value="0" {if isset($menu['status']) && $menu['status'] == 0} checked="checked"{/if} /> 隐藏</label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">排序</label>
                    <div class="col-sm-9">
                        <input type="text" name="displayorder" class="form-control" value="{$menu['displayorder']}" />
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-12 col-lg-1">
                <input name="submit" type="submit" value="保存设置" class="btn btn-primary">
                <input type="hidden" name="token" value="{$_W['token']}"/>
            </div>
        </div>
    </form>
</div>
<script>
    function selectIcon(iconname) {
        $('#icon').val(iconname);
        //$('#showicon').css() ;
        $('#showicon').attr("class","icons " + iconname);

        //$('.clearfix > span').attr("class","icons " + iconname);
        //$(obj).select('span');
    }

</script>
{/if}
{template 'common/footer'}